//
//  MyViewController.m
//  HAODE
//
//  Created by panquanReabam.com on 15/9/8.
//  Copyright (c) 2015年 reabam.com. All rights reserved.
//
#import "RDVTabBarController.h"
#import "MyViewController.h"
#import "HAODEsingleton.h"
#import "DailyTableViewCell.h"
#import "TheLoginViewController.h"

#import "SelectTheCertificationViewController.h"
#import "HttpRequest.h"
#import "RDVTabBarController.h"
#import "MJRefresh.h"

#import "MemberInformationViewController.h"

#import "ServiceListViewController.h"
#import "RefundListViewController.h"





#import "AboutUsViewController.h"
#import "UIButton+WebCache.h"
#import "SalesAnalysisDetailPageViewController.h"
#import "managementViewController.h"
#import "UMSocial.h"
#import "TradesViewController.h"
#import "MActViewController.h"
#import "MCouponViewController.h"
#import "ProductView.h"
#import "BusinessMemberfindIntegralListViewController.h"
#import "BusinessMemberAddressViewController.h"
#import "SelectTag_NewViewController.h"
#import "TheEditingViewController.h"
@interface MemberInformationViewController ()<UITableViewDataSource,UITableViewDelegate,UIScrollViewDelegate, UITextViewDelegate,UIImagePickerControllerDelegate,UIAlertViewDelegate,UIGestureRecognizerDelegate,UINavigationControllerDelegate,UIActionSheetDelegate,UMSocialUIDelegate>

{
    MJRefreshHeaderView* _header;
    MJRefreshFooterView* _footer;
    NSArray *array;
    NSArray *array1;
    NSArray *array2;
    NSArray *array3;
    UIButton *noticeCountBtn;
    UIWebView *web;
    UILabel* name1;
    UIButton* name;
    HAODEsingleton* commdity;
    UIImageView *imageView ;
    UIView *headerView;
    UIButton* renzhenButton;
    NSDictionary *DataLine;
    UIButton *button;
    UIButton*TheMessageBtn;
    NSString *url;
    UILabel*userType;
    NSString* userAudit;
    ProductView*clothView;
    
}
@property(nonatomic,strong)   NSString*shuoming;
@property(nonatomic,strong)   NSString*shareUrl;
@end

@implementation MemberInformationViewController
@synthesize alt = alt;
-(void)BackAction:(UIButton *)sender{
    
    
    [self.navigationController popViewControllerAnimated:YES];
    
}
- (void)viewDidDisappear:(BOOL)animated

{
    
    [super viewDidDisappear:animated];
    
    
    
    self.navigationController.delegate = nil;
    
}

-(void)viewWillAppear:(BOOL)animated{
    [super viewWillAppear:animated];
    [[self rdv_tabBarController] setTabBarHidden:YES];
    self.navigationController.navigationBarHidden=NO;
        self.navigationController.navigationBar.barStyle = UIBaselineAdjustmentNone;
    UILabel *lineLabel=[[UILabel alloc] initWithFrame:CGRectMake(0, 43,ScreenWidth, 1)];
    [lineLabel setBackgroundColor:[UIColor colorWithRed:238.0/255.0 green:238.0/255.0 blue:238.0/255.0 alpha:1.0]];
    [self.navigationController.navigationBar addSubview:lineLabel];
    [self.navigationController.navigationBar setTintColor:[UIColor whiteColor]];
    [[UINavigationBar appearance] setBarTintColor:Color];
    
    UIImage* backImage = [UIImage imageNamed:@"fanhui"];
    CGRect backframe = CGRectMake(0,0,30,30);

    UIButton* backButton= [[UIButton alloc] initWithFrame:backframe];
    [backButton setBackgroundImage:backImage forState:UIControlStateNormal];
    backButton.titleLabel.font=[UIFont systemFontOfSize:13];
    [backButton addTarget:self action:@selector(BackAction:) forControlEvents:UIControlEventTouchUpInside];
    UIBarButtonItem* leftBarButtonItem = [[UIBarButtonItem alloc] initWithCustomView:backButton];
    self.navigationItem.leftBarButtonItem = leftBarButtonItem;
    self.navigationController.delegate = self;
    
    self.navigationController.interactivePopGestureRecognizer.delegate = self;
    self.title = @"会员基本详情";
    
    [self.navigationController.navigationBar setTitleTextAttributes:[NSDictionary dictionaryWithObjectsAndKeys:
                                                                     backColor,
                                                                     UITextAttributeTextColor,
                                                                     [UIColor colorWithRed:0.0 green:0.0 blue:0.0 alpha:1],
                                                                     UITextAttributeTextShadowColor,
                                                                     [NSValue valueWithUIOffset:UIOffsetMake(0, 0)],
                                                                     UITextAttributeTextShadowOffset,
                                                                     [UIFont fontWithName:@"Helvetica Neue" size:tetlefot],
                                                                     UITextAttributeFont,nil]];
    
    
    
    
    
    
    
   
  
    commdity = [HAODEsingleton shared];
 
    if ([commdity.gengxin isEqualToString:@""]) {

        NSUserDefaults *user = [NSUserDefaults standardUserDefaults];
        NSString* Token = [user objectForKey:@"tokenId"];
        NSMutableDictionary *params = [NSMutableDictionary new];
        
        [params setValue:Token forKey:@"tokenId"];
        [params setValue:commdity.memberId forKey:@"id"];
        [params setValue:commdity.userName forKey:@"userName"];
        [params setValue:commdity.NickName forKey:@"nickName"];
        [params setValue:commdity.ProvinceName forKey:@"provinceName"];
        [params setValue:commdity.CityName forKey:@"cityName"];
        [params setValue:commdity.RegionName forKey:@"regionName"];
        [params setValue:commdity.OpenID forKey:@"openId"];
        [params setValue:commdity.adresssss  forKey:@"address"];
        [params setValue:commdity.Phone forKey:@"phone"];
        
        NSMutableArray *mDocumentLine=[NSMutableArray array];
        
        
        for (int i=0; i<commdity.selectTagCodeArray.count; i++) {
            
            NSMutableDictionary *dic = [NSMutableDictionary dictionary];
            NSString *codeStr = [commdity.selectTagCodeArray objectAtIndex:i];
            [dic setValue:codeStr forKey:@"code"];
            [mDocumentLine addObject:dic];
            
            
        }
        
        NSLog(@"====%@",mDocumentLine);
        [params setValue:mDocumentLine  forKey:@"tags"];
        [params setValue:commdity.Sex forKey:@"sex"];
        [params setValue:commdity.Memo forKey:@"memo"];

        NSLog(@"33333333====%@",params);
        
        [HttpRequest requestData:@"Business/Member/Add" params:params success:^(BOOL isSuccess, SeverData *severDataDict) {
            if (isSuccess) {
                
                NSLog(@"33333333====%@",severDataDict.dataDict);
                if ([[severDataDict.dataDict objectForKey:@"ResultInt"] integerValue]==0) {
                    [Global hideProgressHUDInternal:self.view];
                   [self gengxin];
                    commdity.gengxin=@"123";
                    
                }else{
                    [Global hideProgressHUDInternal:self.view];
                    NSString *requestResultStr=[severDataDict.dataDict objectForKey:@"ResultString"];
                    [Global showTextHudSub:requestResultStr view:self.view];
                }
                
            }
            else
            {
                [Global hideProgressHUDInternal:self.view];
                
                [Global showTextHudSub:@"连接失败" view:self.view];
            }
            
        }];


        
    }else{
        
        
        
    }
    
    
}
-(void)viewDidLoad{
    [super viewDidLoad];
    
     commdity = [HAODEsingleton shared];
    [self loadViewTabel];
    [self gengxin];

   _table.separatorStyle=UITableViewCellSeparatorStyleNone;

}
- (void)gengxin
{

    NSUserDefaults *user = [NSUserDefaults standardUserDefaults];
    NSString* Token = [user objectForKey:@"tokenId"];
    if (Token ==nil) {
        Token=@"dd";
    }
    NSMutableDictionary *param = [NSMutableDictionary new];
    [param setValue:Token forKey:@"tokenId"];
    [param setValue:commdity.memberId forKey:@"memberId"];
//  NSLog(@"====%@",param);[Global showIndeterminateHudSub:@"加载中，请稍后。。。" delay:30 view:self.view];
    
    [HttpRequest requestData:@"Business/Member/Detail" params:param success:^(BOOL isSuccess, SeverData *severDataDict) {
        if (isSuccess) {
            
            NSLog(@"33333333====%@",severDataDict.dataDict);
            if ([[severDataDict.dataDict objectForKey:@"ResultInt"] integerValue]==0) {
                [Global hideProgressHUDInternal:self.view];
                
                NSMutableArray* arrr=[[NSMutableArray alloc]init];
                commdity.Dict=severDataDict.dataDict ;
                arrr=[severDataDict.dataDict objectForKey:@"tags"];
                
                
                NSMutableArray* Codearrr=[[NSMutableArray alloc]init];
                NSMutableArray* Namearrr=[[NSMutableArray alloc]init];
                for (NSDictionary* dicc in arrr )
                {
                    [Codearrr addObject:[dicc valueForKey:@"code"]];
                    [Namearrr addObject:[dicc valueForKey:@"content"]];
                    
                    
                }
                
                commdity.selectTagNameArray=[Namearrr copy];
                commdity.selectTagCodeArray=[Codearrr copy];
                commdity.Memo=[severDataDict.dataDict objectForKey:@"memo"];
                commdity.memberId=[severDataDict.dataDict objectForKey:@"memberId"];
                commdity.DataLine=[severDataDict.dataDict objectForKey:@"tags"];
                commdity.WeChatId=[severDataDict.dataDict objectForKey:@"nickName"];
                commdity.ProvinceName=[severDataDict.dataDict objectForKey:@"provinceName"];
                commdity.CityName=[severDataDict.dataDict objectForKey:@"cityName"];
                
                commdity.RegionName=[severDataDict.dataDict objectForKey:@"regionName"];
                commdity.adresssss=[severDataDict.dataDict objectForKey:@"address"];
                
                commdity.Phone=[severDataDict.dataDict objectForKey:@"phone"];
                commdity.OpenID=[severDataDict.dataDict objectForKey:@"openId"];
                
                commdity.userName=[severDataDict.dataDict objectForKey:@"userName"];
                commdity.Sex=[severDataDict.dataDict objectForKey:@"sex"];
                commdity.consigneeAddr=[severDataDict.dataDict objectForKey:@"consigneeAddr"];
                commdity.consigneeName=[severDataDict.dataDict objectForKey:@"consigneeName"];
                commdity.consigneePhone=[severDataDict.dataDict objectForKey:@"consigneePhone"];
                
                [self tableHeadView];
                
              
                [_table reloadData];
                
                
            }else{
                [Global hideProgressHUDInternal:self.view];
                NSString *requestResultStr=[severDataDict.dataDict objectForKey:@"ResultString"];
                UIAlertView * alert = [[UIAlertView alloc]initWithTitle:@"温馨提示" message:requestResultStr delegate:self cancelButtonTitle:@"确定返回" otherButtonTitles: nil];
                [alert show];
                
            }
            
        }
        else
        {
            [Global hideProgressHUDInternal:self.view];
            
            [Global showTextHudSub:@"连接失败" view:self.view];
        }
        
    }];
    
}



- (void)loadViewTabel{

    array = @[@"编号",@"姓名",@"微信昵称",@"电话",@"性别",@"收货地址",@"标签"];
    [self tableHeadView];
}


- (void)tableHeadView
{
    
    [headerView removeFromSuperview];
    headerView = [[UIView alloc]initWithFrame:CGRectMake(0, 0, ScreenWidth,370/2)];
    UIImageView* heardimage=[[UIImageView alloc]initWithFrame:CGRectMake(12.5, 15, ScreenWidth-25, 330/2)];
    heardimage.image=[UIImage imageNamed:@"6833C86C-16D9-4F67-B2A4-DBBD5300F242.png"];
    [headerView addSubview:heardimage];
    
    commdity=[HAODEsingleton shared];
    
    
    
    name=[[UIButton alloc]initWithFrame:CGRectMake(15, 270/2, ScreenWidth-30, titleNamefot)];
    [name setTitle:[NSString stringWithFormat:@"%@(%@)", commdity.userName, commdity.Phone] forState:UIControlStateNormal];
    name.contentHorizontalAlignment = UIControlContentHorizontalAlignmentCenter;
    [name setTitleColor:[UIColor blackColor] forState:UIControlStateNormal];
    name.titleLabel.font=[UIFont systemFontOfSize:titleNamefot];
    [headerView addSubview:name];
    

//    _table.frame=CGRectMake(0, 0, ScreenWidth, ScreenHeight);
//    self.table.tableHeaderView = headerView;
 
    UIView * tableFooterViews=[[UIView alloc]initWithFrame:CGRectMake(0, 0, ScreenWidth, 500)];
    
    if (commdity.selectTagCodeArray.count>0) {
        


        
        for (int i = 0,j = 0; i < commdity.selectTagCodeArray.count; i++) {
            if (i % 4 == 0) {
                j++;
            }
            
            clothView = [[ProductView alloc]initWithFrame:CGRectMake(12.5+(ScreenWidth/4-5)*(i%4), (31*j)-23, ScreenWidth/4-15, 25)];
            clothView.buttonView.titleLabel.textAlignment=NSTextAlignmentCenter;
            clothView.buttonView.titleLabel.font=[UIFont systemFontOfSize:contenfot];
            [clothView.buttonView setTitle: [commdity.selectTagNameArray objectAtIndex:i]  forState:UIControlStateNormal];
            CGColorSpaceRef colorSpace2 = CGColorSpaceCreateDeviceRGB();
            CGColorRef colorref2 = CGColorCreate(colorSpace2,(CGFloat[]){209/255.0,170/255.0, 56/255.0, 1.0   });
            clothView.buttonView.backgroundColor=[UIColor colorWithRed:255/255.0 green:250/255.0 blue:234/255.0 alpha:1];
            [clothView.buttonView.layer setBorderColor:colorref2];//边框颜色
            
            [clothView.buttonView setTitleColor:[UIColor colorWithRed:207/255.0 green:170/255.0 blue:68/255.0 alpha:1] forState:0];
            [tableFooterViews addSubview:clothView];
            
        }
        
    
        
        UIView*huiseview=[[UIView alloc]initWithFrame:CGRectMake(0,clothView.bottom+9, ScreenWidth, 10)];
        huiseview.backgroundColor=zuiqianhuicolor;
        huiseview.layer.borderWidth = 0.3;
        huiseview.layer.borderColor = qianhuicolor.CGColor;
        [tableFooterViews addSubview:huiseview];
        UILabel*beizhu=[[UILabel alloc]initWithFrame:CGRectMake(15, huiseview.bottom, 50, 50)];
        beizhu.text=@"备注";
        beizhu.font= [UIFont systemFontOfSize:16];
        [beizhu setTextColor:[UIColor colorWithRed:53/255.0 green:53/255.0 blue:53/255.0 alpha:1]];
        [tableFooterViews addSubview:beizhu];
        UIView*beizhuV=[[UIView alloc]initWithFrame:CGRectMake(0, beizhu.bottom, ScreenWidth, 500)];
        beizhuV.backgroundColor=zuiqianhuicolor;
        beizhuV.layer.borderWidth = 0.3;
        beizhuV.layer.borderColor = qianhuicolor.CGColor;
        [tableFooterViews addSubview:beizhuV];
        renzhenButton=[[UIButton alloc]init];
        renzhenButton.backgroundColor=[UIColor clearColor];
        renzhenButton.frame=CGRectMake(ScreenWidth-38, huiseview.bottom+10, 33, 33);
        [renzhenButton setImage:[UIImage imageNamed:@"shouqi"] forState:UIControlStateNormal];
        [renzhenButton addTarget:self action:@selector(beizhu:) forControlEvents:UIControlEventTouchUpInside];
        [tableFooterViews addSubview:renzhenButton];
        UIButton*jiada=[[UIButton alloc]init];
        jiada.backgroundColor=[UIColor clearColor];
        jiada.frame=CGRectMake(0, huiseview.bottom, ScreenWidth, 50);
        [jiada addTarget:self action:@selector(beizhu:) forControlEvents:UIControlEventTouchUpInside];
        [tableFooterViews addSubview:jiada];
        UIImageView *_xianview = [[UIImageView alloc]initWithFrame:CGRectMake(15, 0, ScreenWidth-30, 0.3)];
        _xianview.image=[UIImage imageNamed:@"hengxian"];
        
        [tableFooterViews addSubview:_xianview];
    }else{
    
    
       
        UIView*huiseview=[[UIView alloc]initWithFrame:CGRectMake(0,0, ScreenWidth, 10)];
        huiseview.backgroundColor=zuiqianhuicolor;
        huiseview.layer.borderWidth = 0.3;
        huiseview.layer.borderColor = qianhuicolor.CGColor;
        [tableFooterViews addSubview:huiseview];
        UILabel*beizhu=[[UILabel alloc]initWithFrame:CGRectMake(15, huiseview.bottom, 50, 50)];
        beizhu.text=@"备注";
        beizhu.font= [UIFont systemFontOfSize:16];
        [beizhu setTextColor:[UIColor blackColor]];
        [tableFooterViews addSubview:beizhu];
        UIView*beizhuV=[[UIView alloc]initWithFrame:CGRectMake(0, beizhu.bottom, ScreenWidth, 500)];
        beizhuV.backgroundColor=zuiqianhuicolor;
        beizhuV.layer.borderWidth = 0.3;
        beizhuV.layer.borderColor = qianhuicolor.CGColor;
        [tableFooterViews addSubview:beizhuV];
        
        renzhenButton=[[UIButton alloc]init];
        renzhenButton.backgroundColor=[UIColor clearColor];
        renzhenButton.frame=CGRectMake(ScreenWidth-38, huiseview.bottom+10, 33, 33);
        [renzhenButton setImage:[UIImage imageNamed:@"shouqi"] forState:UIControlStateNormal];
        [renzhenButton addTarget:self action:@selector(beizhu:) forControlEvents:UIControlEventTouchUpInside];
        [tableFooterViews addSubview:renzhenButton];
        
        UIButton*jiada=[[UIButton alloc]init];
        jiada.backgroundColor=[UIColor clearColor];
        jiada.frame=CGRectMake(0, huiseview.bottom, ScreenWidth, 50);
        [jiada addTarget:self action:@selector(beizhu:) forControlEvents:UIControlEventTouchUpInside];
        [tableFooterViews addSubview:jiada];

    }
    self.table.tableFooterView = tableFooterViews;
//     self.table.backgroundColor=zuiqianhuicolor;
}


-(void)beizhu:(UIButton*)sender{
   
        
        TheEditingViewController * Login=[[TheEditingViewController alloc]init];
        Login.sat=@"Memo";
        Login.conten=commdity.Memo;
        Login.titleName=@"备注";
        [self.navigationController pushViewController:Login animated:YES];

    
    
}



- (void)addFooter
{
    
    
    MJRefreshHeaderView* footer = [MJRefreshHeaderView header];
    footer.scrollView = _table;
    footer.beginRefreshingBlock = ^(MJRefreshBaseView* refreshView)
    {
        [self loadViewTabel];
        [self tableHeadView];
        
        [self performSelector:@selector(doneWithView:) withObject:refreshView afterDelay:3.0f];
        NSLog(@"%@--->正在刷新", refreshView.class);
    };
    
}
- (void)doneWithView:(MJRefreshBaseView *)refreshView
{
    [_table reloadData];
    [refreshView endRefreshing];
}


#pragma mark--TableViewDelegate

- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
    return array.count;
}

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
    static NSString *CellIdentifier = @"Cell";
    
    DailyTableViewCell* cell = (DailyTableViewCell*)[tableView dequeueReusableCellWithIdentifier:CellIdentifier];
    if (cell == nil)
    {
        NSArray* nib = [[NSBundle mainBundle] loadNibNamed:@"DailyTableViewCell" owner:self options:nil];
        cell = [nib objectAtIndex:0];
    }
    cell.textLabel.font=[UIFont systemFontOfSize:titleNamefot];
    
    cell.textLabel.textColor=[UIColor colorWithRed:51/255.0 green:51/255.0 blue:51/255.0 alpha:1]
;
    cell.textLabel.text = [array objectAtIndex:indexPath.row];
    if ([[array objectAtIndex:indexPath.row]isEqualToString:@"编号"]) {
        
        UILabel*label=[[UILabel alloc]initWithFrame:CGRectMake(ScreenWidth-200, 0, 186, 50)];
        label.text=[NSString stringWithFormat:@"%@",[commdity.Dict objectForKey:@"cardNo"]];
        label.textAlignment=NSTextAlignmentRight;
        label.textColor=[UIColor colorWithRed:51/255.0 green:51/255.0 blue:51/255.0 alpha:1]; label.font=[UIFont systemFontOfSize:  15];
        [cell.contentView addSubview:label];
//        UIButton*jiantou = [[UIButton alloc]init];
//        jiantou.frame = CGRectMake(label.right,0, 8, 13);
//        [jiantou setImage:[UIImage imageNamed:@"xiangzuo-.png"] forState:UIControlStateNormal];
//        cell.accessoryView=jiantou;
   
    
    }

    if ([[array objectAtIndex:indexPath.row]isEqualToString:@"姓名"]) {
        
        UILabel*label=[[UILabel alloc]initWithFrame:CGRectMake(ScreenWidth-205, 0, 160, 50)];
        label.text=[NSString stringWithFormat:@"%@",[commdity.Dict objectForKey:@"userName"]];
        label.textAlignment=NSTextAlignmentRight;
        label.textColor=zhonghuiColor; label.font=[UIFont systemFontOfSize:  15];
        [cell.contentView addSubview:label];
        UIButton*jiantou = [[UIButton alloc]init];
        jiantou.frame = CGRectMake(ScreenWidth-30,18, 8, 13);
        [jiantou setImage:[UIImage imageNamed:@"xiangzuo-.png"] forState:UIControlStateNormal];
        [cell.contentView addSubview:jiantou];
    }
    if ([[array objectAtIndex:indexPath.row]isEqualToString:@"微信昵称"]) {
        UILabel*label=[[UILabel alloc]initWithFrame:CGRectMake(ScreenWidth-205, 0, 160, 50)];
        label.text=[NSString stringWithFormat:@"%@",[commdity.Dict objectForKey:@"nickName"]];
        label.textAlignment=NSTextAlignmentRight;
        label.textColor=zhonghuiColor;
        label.font=[UIFont systemFontOfSize:  15];
        [cell.contentView addSubview:label];
        //        UIButton*jiantou = [[UIButton alloc]init];
        //        jiantou.frame = CGRectMake(label.right,0, 8, 13);
        //        [jiantou setImage:[UIImage imageNamed:@"xiangzuo-.png"] forState:UIControlStateNormal];
        //        cell.accessoryView=jiantou;
    }

    if ([[array objectAtIndex:indexPath.row]isEqualToString:@"电话"]) {
        UILabel*label=[[UILabel alloc]initWithFrame:CGRectMake(ScreenWidth-205, 0, 160, 50)];
        label.text=[NSString stringWithFormat:@"%@",[commdity.Dict objectForKey:@"phone"]];
        label.textAlignment=NSTextAlignmentRight;
        label.textColor=zhonghuiColor;
         label.font=[UIFont systemFontOfSize:  15];
        [cell.contentView addSubview:label];
//        UIButton*jiantou = [[UIButton alloc]init];
//        jiantou.frame = CGRectMake(label.right,0, 8, 13);
//        [jiantou setImage:[UIImage imageNamed:@"xiangzuo-.png"] forState:UIControlStateNormal];
//        cell.accessoryView=jiantou;
    }
    if ([[array objectAtIndex:indexPath.row]isEqualToString:@"性别"]) {        UILabel*label=[[UILabel alloc]initWithFrame:CGRectMake(ScreenWidth-205, 0, 160, 50)];
        label.text=[NSString stringWithFormat:@"%@",[commdity.Dict objectForKey:@"sex"]];
        label.textAlignment=NSTextAlignmentRight;
        label.textColor=zhonghuiColor;
        label.font=[UIFont systemFontOfSize:  15];
        [cell.contentView addSubview:label];
        UIButton*jiantou = [[UIButton alloc]init];
        jiantou.frame = CGRectMake(ScreenWidth-30,18, 8, 13);
        [jiantou setImage:[UIImage imageNamed:@"xiangzuo-.png"] forState:UIControlStateNormal];
        [cell.contentView addSubview:jiantou];
    }
    if ([[array objectAtIndex:indexPath.row]isEqualToString:@"收货地址"]) {        UILabel*label=[[UILabel alloc]initWithFrame:CGRectMake(ScreenWidth-205, 0, 160, 50)];
        label.text=[NSString stringWithFormat:@"%@",[commdity.Dict objectForKey:@"addrQty"]];

        label.textAlignment=NSTextAlignmentRight;
        label.textColor=zhonghuiColor; label.font=[UIFont systemFontOfSize:  15];
        [cell.contentView addSubview:label];
        UIButton*jiantou = [[UIButton alloc]init];
        jiantou.frame = CGRectMake(ScreenWidth-30,18, 8, 13);
        [jiantou setImage:[UIImage imageNamed:@"xiangzuo-.png"] forState:UIControlStateNormal];
        [cell.contentView addSubview:jiantou];
    }
   if ([[array objectAtIndex:indexPath.row]isEqualToString:@"标签"]) {
        UILabel*label=[[UILabel alloc]initWithFrame:CGRectMake(ScreenWidth-205, 0, 160, 50)];
        label.text=[NSString stringWithFormat:@"已选择%ld个",[[commdity.Dict objectForKey:@"tags"]count]];
        label.textAlignment=NSTextAlignmentRight;
        label.textColor=hongsecolor; label.font=[UIFont systemFontOfSize:  14];
        [cell.contentView addSubview:label];
       UIButton*jiantou = [[UIButton alloc]init];
       jiantou.frame = CGRectMake(ScreenWidth-30,18, 8, 13);
       [jiantou setImage:[UIImage imageNamed:@"xiangzuo-.png"] forState:UIControlStateNormal];
       [cell.contentView addSubview:jiantou];    }
    
    if (array.count !=indexPath.row+1) {
        UILabel *lineLabel1=[[UILabel alloc] initWithFrame:CGRectMake(15, 50-0.35, ScreenWidth-30, 0.3)];
        lineLabel1.backgroundColor=qianhuicolor;
        [cell.contentView addSubview:lineLabel1];
        
    }
    
   
    return cell;
}

- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
    
    [tableView deselectRowAtIndexPath:indexPath animated:YES];
    DailyTableViewCell *cell =(DailyTableViewCell *)[tableView cellForRowAtIndexPath:indexPath];
    if ([cell.textLabel.text isEqualToString:@"姓名"]) {
        
        TheEditingViewController * Login=[[TheEditingViewController alloc]init];
        Login.sat=@"userName";
        Login.conten=commdity.userName;
        Login.titleName=@"姓名";
        [self.navigationController pushViewController:Login animated:YES];
        
    }
    if ([cell.textLabel.text isEqualToString:@"电话"]) {
//        
//        TheEditingViewController * Login=[[TheEditingViewController alloc]init];
//        Login.sat=@"Phone";
//        Login.conten=commdity.Phone;
//        Login.titleName=@"电话";
//        [self.navigationController pushViewController:Login animated:YES];
        
    }
    if ([cell.textLabel.text isEqualToString:@"性别"]) {
        TheEditingViewController * Login=[[TheEditingViewController alloc]init];
        Login.sat=@"Sex";
        Login.conten=commdity.Sex;
        Login.titleName=@"性别";
        [self.navigationController pushViewController:Login animated:YES];
        
        
    }
    
    if ([cell.textLabel.text isEqualToString:@"收货地址"]) {
    
        
        BusinessMemberAddressViewController *detailViewController = [[BusinessMemberAddressViewController alloc] init];
        [self.navigationController pushViewController:detailViewController animated:YES];

        
        
    }
    if ([cell.textLabel.text isEqualToString:@"标签"]) {
        SelectTag_NewViewController *detailViewController = [[SelectTag_NewViewController alloc] init];
        detailViewController.optionNameString=@"MemberTag";
        detailViewController.selectedTagCodeArray=commdity.selectTagCodeArray;
        detailViewController.selectedTagNameArray=commdity.selectTagNameArray;
        [self.navigationController pushViewController:detailViewController animated:YES];
        
        
    }
       }
- (CGFloat) tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath
{
    
     if (array.count==0) {
        return 118/2;
    }
    return  50;
}



//- (CGFloat)tableView:(UITableView *)tableView heightForFooterInSection:(NSInteger)section
//{
//
//    return 1;
//}

- (void)showAlertWait
{
    alt = [[UIAlertView alloc] initWithTitle:@"网络不稳定 ！" message:@"请确认网络" delegate:self cancelButtonTitle:nil otherButtonTitles: nil];
    [alt show];
    
    [self performSelector:@selector(hideAlert) withObject:nil afterDelay:1.0f];
    
}

- (void)showAlertMessage:(NSString *)msg
{
    alt = [[UIAlertView alloc] initWithTitle:@"温馨提示" message:msg delegate:nil cancelButtonTitle:nil otherButtonTitles: nil];
    [alt show];
    
    [self performSelector:@selector(hideAlert) withObject:nil afterDelay:1.0f];
}
- (void)hideAlert
{
    if (alt != nil)
    {
        [alt dismissWithClickedButtonIndex:0 animated:YES];
        alt = nil;
    }
}

@end
